// 标准规范

import request from "./axios";

export const TowerAPI = {
    getList: (params) => request.get("/entities/tower", { params }),

    create: (data) => request.post("/entities/tower", data),

    getDetail: (id) => request.get(`/entities/tower/${id}`),

    update: (id, data) => request.put(`/entities/tower/${id}`, data),

    delete: (id) => request.delete(`/entities/tower/${id}`),


    //上传
    import: (file) => {
        const formData = new FormData();
        formData.append("file", file); // 假设后端接收文件的参数名为file
        return request.post(`/entities/tower/import`, formData, {
            headers: {
                "Content-Type": "multipart/form-data", // 上传文件需指定该Content-Type
            },
        });
    },
    // 导入 （批量创建）
    importData: (projectId, data) =>
        request.post(`/entities/tower/bulk/${projectId}`, data),

    // 下载模版
    importTemplate: () =>
        request.get(`/entities/tower/importTemplate`, {
            responseType: "blob", // 表明返回服务器返回的数据类型
        }),
};
